package cn.com.git.example.common.util.object;

import com.alibaba.fastjson.JSONObject;

import java.util.List;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2020/4/3 15:32
 */
public class JSONUtils {

    public static String toJson(Object object) {
        return JSONObject.toJSONString(object);
    }

    public static <T> T fromJson(String json, Class<T> tClass) {
        return JSONObject.parseObject(json, tClass);
    }

    public static <T> List<T> fromJson2List(String json, Class<T> tClass) {
        return JSONObject.parseArray(json, tClass);
    }
}

